package choose;

public class useSwitch {
    public static void main(String[] args) {
//        use(4);
        use02(1);
    }
    public static void use(int i){
        switch (i){
            case 1:
                System.out.println("我是1,舒服");
                break;
            case 2:
                System.out.println("我是2,舒服");
                break;
            default:
                System.out.println("只有我一个人了哦");
        }
    }

    public static void use01(int i){
        switch (i){
            case 1 ->{
                System.out.println("一");
            }
            case 2->{
                System.out.println("二");
            }
            default -> {
                System.out.println("没有匹配");
            }
        }
    }

    public static void use02(int i){
        String str = switch (i){
            case 1 -> "一";
            case 2 -> "二";
            default -> "";
        };
        System.out.println(str);
    }

}
